import { type Directive, type DirectiveBinding } from "vue";
import nullPng from '@/assets/screenimg/null.png'


export const imgError: Directive = {
  mounted(el: HTMLImageElement, binding: DirectiveBinding) {
    el.onerror = () => {
      el.src = nullPng
    }
    const { value } = binding
    el.src = value
  },
  updated(el: HTMLImageElement, binding: DirectiveBinding) {
    const { value } = binding
    el.src = value
  }
};
